package com.atomscat.lottery.controller.admin;

import com.atomscat.lottery.entity.db.LotteryRecordEntity;
import com.atomscat.lottery.entity.db.LotteryUserRecordEntity;
import com.atomscat.lottery.entity.vo.request.PageLotteryRecordRequest;
import com.atomscat.lottery.entity.vo.response.BaseResponse;
import com.atomscat.lottery.service.LotteryRecordService;
import com.atomscat.lottery.service.VoBaseRespTransformService;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/admin/lottery/record")
@RequiredArgsConstructor
public class LotteryRecordController {
    private final VoBaseRespTransformService voBaseRespTransformService;
    private final LotteryRecordService lotteryRecordService;

    @PostMapping("/page")
    public BaseResponse<Page<LotteryRecordEntity>> lotteryPrizePage(@RequestBody PageLotteryRecordRequest pageLotteryRecordRequest) {
        return voBaseRespTransformService.transformSuccessful(lotteryRecordService.pageLotteryRecordEntity(pageLotteryRecordRequest));
    }

    @PostMapping("/page/record")
    public BaseResponse<Page<LotteryUserRecordEntity>> pageLotteryUserRecord(@RequestBody PageLotteryRecordRequest pageLotteryRecordRequest) {
        return voBaseRespTransformService.transformSuccessful(lotteryRecordService.pageLotteryUserRecord(pageLotteryRecordRequest));
    }


}
